package GUI;

import GUI.RecTable;
import MusicPlayer.PlayerUserInterface;
import GUI.CheckboxChange;
import Records.RecordsMain;
import Database.UpdateLibraryImp;
import java.awt.Color;
import java.awt.Container;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.table.DefaultTableModel;

public class UserInterfaceUI extends javax.swing.JFrame {

    private static String CurrentPath, CurrentSong;
    private final Container c;
    SwitchPic Switch;

    /**
     * Creates new form UserInterfaceUI
     */
    public UserInterfaceUI() {
        c = getContentPane();
        c.setLayout(null);
        int red = 20;
        int green = 153;
        int blue = 211;
        Color BGBlue = new Color(red, green, blue);
        c.setBackground(BGBlue);
        setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
        initComponents();
        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "clickButton");

        getRootPane().getActionMap().put("clickButton", new AbstractAction() {
            public void actionPerformed(ActionEvent ae) {
                if (null != PlayerUserInterface.getStatus()) {
                    switch (PlayerUserInterface.getStatus()) {
                        case "PLAYING":
                            PauseButton.doClick();
                            //System.out.println("Play button clicked");
                            break;
                        case "PAUSED":
                            PlayButton.doClick();
                            //System.out.println("Pause button clicked");
                            break;
                    }
                }
            }
        });

        Action doNothing = new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                //do nothing
            }
        };

        userLibrary.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "doNothing");
        userLibrary.getActionMap().put("doNothing", doNothing);
        songPrefTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "doNothing");
        songPrefTable.getActionMap().put("doNothing", doNothing);
        rssChartsTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "doNothing");
        rssChartsTable.getActionMap().put("doNothing", doNothing);

    }

    public static String getCurrentPath() {
        return CurrentPath;
    }

    /**
     * @param aCurrentPath the CurrentPath to set
     */
    public static void setCurrentPath(String aCurrentPath) {
        CurrentPath = aCurrentPath;
    }

    /**
     * @return the CurrentSong
     */
    public static String getCurrentSong() {
        return CurrentSong;
    }

    /**
     * @param aCurrentSong the CurrentSong to set
     */
    public static void setCurrentSong(String aCurrentSong) {
        CurrentSong = aCurrentSong;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane3 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jCheckBox1 = new javax.swing.JCheckBox();
        albumCover = new javax.swing.JLabel();
        titleLabel = new javax.swing.JLabel();
        TitleLabel1 = new javax.swing.JLabel();
        MusicRecLabel = new javax.swing.JLabel();
        TitleLabel = new javax.swing.JLabel();
        YourLibrary = new javax.swing.JLabel();
        titleTextField = new javax.swing.JTextField();
        artistTextField = new javax.swing.JTextField();
        artistLabel = new javax.swing.JLabel();
        SearchLabel = new javax.swing.JLabel();
        SearchTextField = new javax.swing.JTextField();
        albumLabel = new javax.swing.JLabel();
        albumTextField = new javax.swing.JTextField();
        genreLabel1 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        genreTextField = new javax.swing.JTextField();
        bpmLabel = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        userLibrary = new javax.swing.JTable();
        keyLabel = new javax.swing.JLabel();
        chartSongNum = new javax.swing.JLabel();
        bpmTextField = new javax.swing.JTextField();
        keyTextField = new javax.swing.JTextField();
        NumSongs = new javax.swing.JTextField();
        itunesDownloadButton = new javax.swing.JButton();
        itunesDownloadButton.setVisible(false);
        amazonDownloadButton = new javax.swing.JButton();
        BasedOn = new javax.swing.JLabel();
        SelectAllCheckBox = new javax.swing.JCheckBox();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jScrollPane5 = new javax.swing.JScrollPane();
        songPrefTable = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        rssChartsTable = new javax.swing.JTable();
        ChartTab = new javax.swing.JTabbedPane();
        PopPane = new javax.swing.JPanel();
        PopLabel = new javax.swing.JLabel();
        Echnest3 = new javax.swing.JLabel();
        BillboardCheckbox = new javax.swing.JCheckBox();
        HypeCheckbox = new javax.swing.JCheckBox();
        UKCheckbox = new javax.swing.JCheckBox();
        ShazamCheckbox = new javax.swing.JCheckBox();
        ItunesCheckbox = new javax.swing.JCheckBox();
        CountryPane = new javax.swing.JPanel();
        CountryLabel = new javax.swing.JLabel();
        Echnest1 = new javax.swing.JLabel();
        BillboardCountryCheckbox = new javax.swing.JCheckBox();
        ItunesCountryCheckbox = new javax.swing.JCheckBox();
        RnBPane = new javax.swing.JPanel();
        RnBLabel = new javax.swing.JLabel();
        BillboardRnBCheckbox = new javax.swing.JCheckBox();
        ItunesRnBCheckbox = new javax.swing.JCheckBox();
        Echnest6 = new javax.swing.JLabel();
        ElectronicPane = new javax.swing.JPanel();
        ElectronicLabel = new javax.swing.JLabel();
        BillboardEDMCheckbox = new javax.swing.JCheckBox();
        ItunesEDMCheckbox = new javax.swing.JCheckBox();
        Echnest7 = new javax.swing.JLabel();
        BeatportCheckbox = new javax.swing.JCheckBox();
        LocationLabel = new javax.swing.JLabel();
        YourLibrary1 = new javax.swing.JLabel();
        locationTextField = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        PlayTime = new javax.swing.JTextField();
        StopButton = new javax.swing.JButton();
        PlayButton = new javax.swing.JButton();
        PauseButton = new javax.swing.JButton();
        ProgBar = new javax.swing.JSlider();
        CurrentSongLabel = new javax.swing.JLabel();
        Song_Info_Box = new javax.swing.JLabel();
        Media_Player_Box = new javax.swing.JLabel();
        Library_Box = new javax.swing.JLabel();
        Recommendations_Box = new javax.swing.JLabel();
        feedbackButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        Menu_File = new javax.swing.JMenu();
        Import_Library_Menu_Item = new javax.swing.JMenuItem();
        Menu_Help = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(jTable1);

        jCheckBox1.setText("jCheckBox1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Records: The Premier Music Recommendation Database");
        setAutoRequestFocus(false);
        setBackground(new java.awt.Color(205, 205, 205));
        setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        setForeground(java.awt.Color.white);
        setLocationByPlatform(true);
        setName("TheFrame"); // NOI18N
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        albumCover.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        albumCover.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        albumCover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/itunesmediadatabase/RecordsLogo.png"))); // NOI18N
        albumCover.setAlignmentY(0.0F);
        albumCover.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(59, 59, 59), 3));
        albumCover.setFocusable(false);
        albumCover.setIconTextGap(0);
        albumCover.setMaximumSize(new java.awt.Dimension(145, 145));
        albumCover.setMinimumSize(new java.awt.Dimension(145, 145));
        albumCover.setPreferredSize(new java.awt.Dimension(155, 155));
        albumCover.setRequestFocusEnabled(false);
        getContentPane().add(albumCover, new org.netbeans.lib.awtextra.AbsoluteConstraints(36, 65, 174, 174));

        titleLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        titleLabel.setText("Title:");
        getContentPane().add(titleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 70, -1, 20));

        TitleLabel1.setBackground(new java.awt.Color(66, 66, 66));
        TitleLabel1.setFont(new java.awt.Font("Arial", 1, 30)); // NOI18N
        TitleLabel1.setForeground(new java.awt.Color(10, 10, 10));
        TitleLabel1.setText("rec");
        getContentPane().add(TitleLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 8, -1, -1));

        MusicRecLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        MusicRecLabel.setText("Your Library");
        getContentPane().add(MusicRecLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 260, -1, 40));

        TitleLabel.setBackground(new java.awt.Color(66, 66, 66));
        TitleLabel.setFont(new java.awt.Font("Arial", 0, 30)); // NOI18N
        TitleLabel.setForeground(new java.awt.Color(10, 10, 10));
        TitleLabel.setText("ords");
        getContentPane().add(TitleLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(67, 8, -1, -1));

        YourLibrary.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        YourLibrary.setText("Your Recommendations");
        getContentPane().add(YourLibrary, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 260, -1, -1));

        titleTextField.setEditable(false);
        titleTextField.setBackground(new java.awt.Color(255, 255, 255));
        titleTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        titleTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        titleTextField.setPreferredSize(new java.awt.Dimension(337, 21));
        getContentPane().add(titleTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 70, 370, 20));

        artistTextField.setEditable(false);
        artistTextField.setBackground(new java.awt.Color(255, 255, 255));
        artistTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        artistTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        artistTextField.setPreferredSize(new java.awt.Dimension(337, 21));
        getContentPane().add(artistTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 100, 370, 20));

        artistLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        artistLabel.setText("Artist:");
        getContentPane().add(artistLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 100, -1, 20));

        SearchLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        SearchLabel.setText("Search:");
        getContentPane().add(SearchLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 260, 60, 40));

        SearchTextField.setBackground(new java.awt.Color(242, 242, 242));
        SearchTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        SearchTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        SearchTextField.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 2));
        SearchTextField.setMinimumSize(new java.awt.Dimension(250, 21));
        SearchTextField.setPreferredSize(new java.awt.Dimension(250, 21));
        SearchTextField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                SearchTextFieldKeyPressed(evt);
            }
        });
        getContentPane().add(SearchTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 270, 160, -1));

        albumLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        albumLabel.setText("Album:");
        getContentPane().add(albumLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 130, -1, 20));

        albumTextField.setEditable(false);
        albumTextField.setBackground(new java.awt.Color(255, 255, 255));
        albumTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        albumTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        albumTextField.setPreferredSize(new java.awt.Dimension(337, 21));
        getContentPane().add(albumTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 130, 370, 20));

        genreLabel1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        genreLabel1.setText("Genre: ");
        getContentPane().add(genreLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 160, -1, 20));

        jLabel4.setBackground(new java.awt.Color(255, 153, 0));
        jLabel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 4));
        jLabel4.setMaximumSize(new java.awt.Dimension(11111, 11111));
        jLabel4.setMinimumSize(new java.awt.Dimension(360, 190));
        jLabel4.setOpaque(true);
        jLabel4.setPreferredSize(new java.awt.Dimension(360, 190));
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 260, 240, 40));

        genreTextField.setEditable(false);
        genreTextField.setBackground(new java.awt.Color(255, 255, 255));
        genreTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        genreTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        genreTextField.setPreferredSize(new java.awt.Dimension(337, 21));
        getContentPane().add(genreTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 160, 370, 20));

        bpmLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        bpmLabel.setText("BPM:");
        getContentPane().add(bpmLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 220, -1, 20));

        jScrollPane7.setMinimumSize(new java.awt.Dimension(620, 220));
        jScrollPane7.setPreferredSize(new java.awt.Dimension(620, 220));

        userLibrary.setAutoCreateRowSorter(true);
        userLibrary.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Song Title", "Artist", "Album", "Genre", "Energy", "Dance", "Tone", "Tempo", "Key"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        userLibrary.setMinimumSize(new java.awt.Dimension(525, 128));
        userLibrary.setSelectionBackground(new java.awt.Color(0, 185, 228));
        userLibrary.setUpdateSelectionOnSort(false);
        userLibrary.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                userLibraryMouseClicked(evt);
            }
        });
        userLibrary.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                userLibraryEnter(evt);
            }
        });
        jScrollPane7.setViewportView(userLibrary);
        if (userLibrary.getColumnModel().getColumnCount() > 0) {
            userLibrary.getColumnModel().getColumn(0).setPreferredWidth(120);
            userLibrary.getColumnModel().getColumn(1).setPreferredWidth(120);
            userLibrary.getColumnModel().getColumn(2).setPreferredWidth(100);
            userLibrary.getColumnModel().getColumn(3).setPreferredWidth(60);
            userLibrary.getColumnModel().getColumn(4).setPreferredWidth(50);
            userLibrary.getColumnModel().getColumn(5).setPreferredWidth(46);
            userLibrary.getColumnModel().getColumn(6).setPreferredWidth(40);
            userLibrary.getColumnModel().getColumn(7).setPreferredWidth(46);
            userLibrary.getColumnModel().getColumn(8).setPreferredWidth(35);
        }

        getContentPane().add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 307, 630, 340));

        keyLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        keyLabel.setText("Key:");
        getContentPane().add(keyLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 220, 40, 20));

        chartSongNum.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        chartSongNum.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        chartSongNum.setText("0 Songs");
        getContentPane().add(chartSongNum, new org.netbeans.lib.awtextra.AbsoluteConstraints(1245, 280, 80, -1));

        bpmTextField.setEditable(false);
        bpmTextField.setBackground(new java.awt.Color(255, 255, 255));
        bpmTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        bpmTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        bpmTextField.setPreferredSize(new java.awt.Dimension(147, 21));
        getContentPane().add(bpmTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 220, 60, 20));

        keyTextField.setEditable(false);
        keyTextField.setBackground(new java.awt.Color(255, 255, 255));
        keyTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        keyTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        keyTextField.setMinimumSize(new java.awt.Dimension(147, 21));
        keyTextField.setPreferredSize(new java.awt.Dimension(147, 21));
        getContentPane().add(keyTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 220, 80, 20));

        NumSongs.setBackground(new java.awt.Color(240, 240, 240));
        NumSongs.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        NumSongs.setText(null);
        NumSongs.setBorder(null);
        NumSongs.setOpaque(false);
        NumSongs.setPreferredSize(new java.awt.Dimension(81, 17));
        getContentPane().add(NumSongs, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 272, 90, -1));

        itunesDownloadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Records/buy_itunes.png"))); // NOI18N
        itunesDownloadButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        itunesDownloadButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itunesDownloadButtonActionPerformed(evt);
            }
        });
        getContentPane().add(itunesDownloadButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 220, 80, 22));

        amazonDownloadButton.setVisible(false);
        amazonDownloadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/itunesmediadatabase/userInterface/AmazonMP3.png"))); // NOI18N
        amazonDownloadButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        amazonDownloadButton.setMaximumSize(new java.awt.Dimension(213, 50));
        amazonDownloadButton.setMinimumSize(new java.awt.Dimension(70, 20));
        amazonDownloadButton.setOpaque(false);
        amazonDownloadButton.setPreferredSize(new java.awt.Dimension(80, 24));
        amazonDownloadButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                amazonDownloadButtonActionPerformed(evt);
            }
        });
        getContentPane().add(amazonDownloadButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 220, 80, 22));
        getContentPane().add(BasedOn, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 280, 390, 20));

        SelectAllCheckBox.setText("All Charts");
        SelectAllCheckBox.setOpaque(false);
        SelectAllCheckBox.setPreferredSize(new java.awt.Dimension(70, 20));
        SelectAllCheckBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                SelectAllCheckBoxItemStateChanged(evt);
            }
        });
        SelectAllCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SelectAllCheckBoxActionPerformed(evt);
            }
        });
        getContentPane().add(SelectAllCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(1240, 125, 80, -1));

        jTabbedPane1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        jTabbedPane1.setMinimumSize(new java.awt.Dimension(525, 128));
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(525, 128));
        jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane1StateChanged(evt);
            }
        });

        jScrollPane5.setPreferredSize(new java.awt.Dimension(525, 128));

        songPrefTable.setAutoCreateRowSorter(true);
        songPrefTable.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        songPrefTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Song Title", "Artist", "Album", "Genre", "Tempo", "Key", "Source"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        songPrefTable.setFillsViewportHeight(true);
        songPrefTable.setMinimumSize(new java.awt.Dimension(525, 128));
        songPrefTable.setSelectionBackground(new java.awt.Color(0, 185, 228));
        songPrefTable.setUpdateSelectionOnSort(false);
        songPrefTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                songPrefTableMouseClicked(evt);
            }
        });
        songPrefTable.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                songPrefTableEnter(evt);
            }
        });
        jScrollPane5.setViewportView(songPrefTable);
        if (songPrefTable.getColumnModel().getColumnCount() > 0) {
            songPrefTable.getColumnModel().getColumn(0).setPreferredWidth(150);
            songPrefTable.getColumnModel().getColumn(1).setPreferredWidth(150);
            songPrefTable.getColumnModel().getColumn(2).setPreferredWidth(100);
            songPrefTable.getColumnModel().getColumn(3).setPreferredWidth(50);
            songPrefTable.getColumnModel().getColumn(4).setPreferredWidth(46);
            songPrefTable.getColumnModel().getColumn(5).setPreferredWidth(30);
            songPrefTable.getColumnModel().getColumn(6).setPreferredWidth(100);
        }

        jTabbedPane1.addTab("Recommendations", jScrollPane5);

        jPanel1.setPreferredSize(new java.awt.Dimension(525, 128));
        jPanel1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                jPanel1FocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                jPanel1FocusLost(evt);
            }
        });

        jScrollPane2.setPreferredSize(new java.awt.Dimension(525, 128));

        rssChartsTable.setAutoCreateRowSorter(true);
        rssChartsTable.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        rssChartsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Song Title", "Artist", "Album", "Genre", "Tempo", "Key", "Charts"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        rssChartsTable.setFillsViewportHeight(true);
        rssChartsTable.setMinimumSize(new java.awt.Dimension(525, 128));
        rssChartsTable.setSelectionBackground(new java.awt.Color(0, 185, 228));
        rssChartsTable.setUpdateSelectionOnSort(false);
        rssChartsTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                rssChartsTableMouseClicked(evt);
            }
        });
        rssChartsTable.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                rssChartsTableEnter(evt);
            }
        });
        jScrollPane2.setViewportView(rssChartsTable);
        if (rssChartsTable.getColumnModel().getColumnCount() > 0) {
            rssChartsTable.getColumnModel().getColumn(0).setPreferredWidth(150);
            rssChartsTable.getColumnModel().getColumn(1).setPreferredWidth(150);
            rssChartsTable.getColumnModel().getColumn(2).setPreferredWidth(100);
            rssChartsTable.getColumnModel().getColumn(3).setPreferredWidth(50);
            rssChartsTable.getColumnModel().getColumn(4).setPreferredWidth(46);
            rssChartsTable.getColumnModel().getColumn(5).setPreferredWidth(30);
            rssChartsTable.getColumnModel().getColumn(6).setPreferredWidth(100);
        }

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Charts", jPanel1);

        getContentPane().add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 280, 640, 370));

        ChartTab.setBackground(new java.awt.Color(205, 205, 205));
        ChartTab.setToolTipText("");
        ChartTab.setAlignmentX(0.0F);
        ChartTab.setAlignmentY(0.0F);
        ChartTab.setMinimumSize(new java.awt.Dimension(1280, 130));
        ChartTab.setName(""); // NOI18N
        ChartTab.setPreferredSize(new java.awt.Dimension(1280, 130));

        PopPane.setBackground(new java.awt.Color(205, 205, 195));
        PopPane.setAlignmentX(0.0F);
        PopPane.setAlignmentY(0.0F);
        PopPane.setMinimumSize(new java.awt.Dimension(206, 295));
        PopPane.setPreferredSize(new java.awt.Dimension(206, 295));
        PopPane.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        PopLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        PopLabel.setText("Pop music charts:");
        PopLabel.setAlignmentX(0.5F);
        PopLabel.setAlignmentY(0.0F);
        PopLabel.setInheritsPopupMenu(false);
        PopPane.add(PopLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        Echnest3.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alexander\\MuRec\\Echonest.png")); // NOI18N
        PopPane.add(Echnest3, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 70, -1, 32));

        BillboardCheckbox.setBackground(new java.awt.Color(205, 205, 205));
        BillboardCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        BillboardCheckbox.setText("Billboard Top 100 Chart");
        BillboardCheckbox.setOpaque(false);
        BillboardCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                BillboardCheckboxItemStateChanged(evt);
            }
        });
        PopPane.add(BillboardCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(83, 35, -1, -1));

        HypeCheckbox.setBackground(new java.awt.Color(205, 205, 205));
        HypeCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        HypeCheckbox.setText("Hype Machine Top 40 Chart");
        HypeCheckbox.setOpaque(false);
        HypeCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                HypeCheckboxItemStateChanged(evt);
            }
        });
        PopPane.add(HypeCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(83, 58, -1, -1));

        UKCheckbox.setBackground(new java.awt.Color(205, 205, 205));
        UKCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        UKCheckbox.setText("UK Official Top 40 Chart");
        UKCheckbox.setOpaque(false);
        UKCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                UKCheckboxItemStateChanged(evt);
            }
        });
        PopPane.add(UKCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(286, 58, -1, -1));

        ShazamCheckbox.setBackground(new java.awt.Color(205, 205, 205));
        ShazamCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        ShazamCheckbox.setText("Shazam Top 100 Chart");
        ShazamCheckbox.setOpaque(false);
        ShazamCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ShazamCheckboxItemStateChanged(evt);
            }
        });
        PopPane.add(ShazamCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 35, -1, -1));

        ItunesCheckbox.setBackground(new java.awt.Color(205, 205, 205));
        ItunesCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        ItunesCheckbox.setText("Itunes Top 40 Chart");
        ItunesCheckbox.setOpaque(false);
        ItunesCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ItunesCheckboxItemStateChanged(evt);
            }
        });
        PopPane.add(ItunesCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(286, 35, -1, -1));

        ChartTab.addTab("Pop", PopPane);

        CountryPane.setBackground(new java.awt.Color(205, 205, 195));
        CountryPane.setMinimumSize(new java.awt.Dimension(206, 295));
        CountryPane.setPreferredSize(new java.awt.Dimension(206, 295));
        CountryPane.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        CountryLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        CountryLabel.setText("Country music charts:");
        CountryLabel.setAlignmentX(0.5F);
        CountryLabel.setAlignmentY(0.0F);
        CountryLabel.setInheritsPopupMenu(false);
        CountryPane.add(CountryLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        Echnest1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alexander\\MuRec\\Echonest.png")); // NOI18N
        CountryPane.add(Echnest1, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 70, -1, 32));

        BillboardCountryCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        BillboardCountryCheckbox.setText("Billboard Country Top 25");
        BillboardCountryCheckbox.setOpaque(false);
        BillboardCountryCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                BillboardCountryCheckboxItemStateChanged(evt);
            }
        });
        CountryPane.add(BillboardCountryCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(81, 35, -1, -1));

        ItunesCountryCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        ItunesCountryCheckbox.setText("Itunes Country Top 40");
        ItunesCountryCheckbox.setOpaque(false);
        ItunesCountryCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ItunesCountryCheckboxItemStateChanged(evt);
            }
        });
        CountryPane.add(ItunesCountryCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(81, 61, -1, -1));

        ChartTab.addTab("Country", CountryPane);

        RnBPane.setBackground(new java.awt.Color(205, 205, 195));
        RnBPane.setMinimumSize(new java.awt.Dimension(106, 295));
        RnBPane.setPreferredSize(new java.awt.Dimension(206, 295));
        RnBPane.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        RnBLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        RnBLabel.setText("Rnb music charts:");
        RnBLabel.setAlignmentX(0.5F);
        RnBLabel.setAlignmentY(0.0F);
        RnBLabel.setInheritsPopupMenu(false);
        RnBPane.add(RnBLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        BillboardRnBCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        BillboardRnBCheckbox.setText("Billboard R&B Top 25");
        BillboardRnBCheckbox.setOpaque(false);
        BillboardRnBCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                BillboardRnBCheckboxItemStateChanged(evt);
            }
        });
        RnBPane.add(BillboardRnBCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(85, 35, -1, -1));

        ItunesRnBCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        ItunesRnBCheckbox.setText("Itunes R&B Top 40");
        ItunesRnBCheckbox.setOpaque(false);
        ItunesRnBCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ItunesRnBCheckboxItemStateChanged(evt);
            }
        });
        RnBPane.add(ItunesRnBCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(85, 61, -1, -1));

        Echnest6.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alexander\\MuRec\\Echonest.png")); // NOI18N
        RnBPane.add(Echnest6, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 70, -1, 32));

        ChartTab.addTab("R&B", RnBPane);

        ElectronicPane.setBackground(new java.awt.Color(205, 205, 195));
        ElectronicPane.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        ElectronicLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ElectronicLabel.setText("Electronic music charts:");
        ElectronicLabel.setAlignmentX(0.5F);
        ElectronicLabel.setAlignmentY(0.0F);
        ElectronicLabel.setInheritsPopupMenu(false);
        ElectronicPane.add(ElectronicLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));

        BillboardEDMCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        BillboardEDMCheckbox.setText("Billboard EDM Top 25");
        BillboardEDMCheckbox.setOpaque(false);
        BillboardEDMCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                BillboardEDMCheckboxItemStateChanged(evt);
            }
        });
        ElectronicPane.add(BillboardEDMCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(83, 35, -1, -1));

        ItunesEDMCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        ItunesEDMCheckbox.setText("Itunes EDM Top 40");
        ItunesEDMCheckbox.setOpaque(false);
        ItunesEDMCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ItunesEDMCheckboxItemStateChanged(evt);
            }
        });
        ElectronicPane.add(ItunesEDMCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(83, 61, -1, -1));

        Echnest7.setIcon(new javax.swing.ImageIcon("C:\\Users\\Alexander\\MuRec\\Echonest.png")); // NOI18N
        ElectronicPane.add(Echnest7, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 70, -1, 32));

        BeatportCheckbox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        BeatportCheckbox.setText("Beatport Top 100");
        BeatportCheckbox.setOpaque(false);
        BeatportCheckbox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                BeatportCheckboxItemStateChanged(evt);
            }
        });
        ElectronicPane.add(BeatportCheckbox, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 35, -1, -1));

        ChartTab.addTab("Electronic", ElectronicPane);

        getContentPane().add(ChartTab, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 125, 640, 130));
        ChartTab.getAccessibleContext().setAccessibleName("");

        LocationLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        LocationLabel.setText("Source: ");
        getContentPane().add(LocationLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 190, -1, 20));

        YourLibrary1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        YourLibrary1.setText("Recommendation Settings");
        getContentPane().add(YourLibrary1, new org.netbeans.lib.awtextra.AbsoluteConstraints(690, 102, -1, -1));

        locationTextField.setEditable(false);
        locationTextField.setBackground(new java.awt.Color(255, 255, 255));
        locationTextField.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        locationTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        locationTextField.setPreferredSize(new java.awt.Dimension(337, 21));
        locationTextField.setRequestFocusEnabled(false);
        getContentPane().add(locationTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 190, 370, 20));

        jPanel2.setBackground(new java.awt.Color(242, 242, 242));
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        PlayTime.setEditable(false);
        PlayTime.setBackground(new java.awt.Color(242, 242, 242));
        PlayTime.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        PlayTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        PlayTime.setText("0:00 - 0:00");
        PlayTime.setBorder(null);
        PlayTime.setOpaque(false);
        jPanel2.add(PlayTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 0, 70, 30));

        StopButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        StopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/itunesmediadatabase/userInterface/Player Stop.png"))); // NOI18N
        StopButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        StopButton.setOpaque(false);
        StopButton.setPreferredSize(new java.awt.Dimension(24, 24));
        StopButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StopButtonActionPerformed(evt);
            }
        });
        jPanel2.add(StopButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(616, 3, -1, -1));
        StopButton.getAccessibleContext().setAccessibleDescription("");

        PlayButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        PlayButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/itunesmediadatabase/userInterface/Player Play.png"))); // NOI18N
        PlayButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        PlayButton.setOpaque(false);
        PlayButton.setPreferredSize(new java.awt.Dimension(24, 24));
        PlayButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PlayButtonActionPerformed(evt);
            }
        });
        jPanel2.add(PlayButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 3, -1, -1));

        PauseButton.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        PauseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/itunesmediadatabase/userInterface/Player Pause.png"))); // NOI18N
        PauseButton.setToolTipText("");
        PauseButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        PauseButton.setMargin(new java.awt.Insets(2, 6, 2, 6));
        PauseButton.setMaximumSize(new java.awt.Dimension(57, 23));
        PauseButton.setMinimumSize(new java.awt.Dimension(57, 23));
        PauseButton.setOpaque(false);
        PauseButton.setPreferredSize(new java.awt.Dimension(24, 24));
        PauseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PauseButtonActionPerformed(evt);
            }
        });
        jPanel2.add(PauseButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(586, 3, -1, -1));

        ProgBar.setBackground(new java.awt.Color(242, 242, 242));
        ProgBar.setValue(0);
        ProgBar.setOpaque(false);
        ProgBar.setPreferredSize(new java.awt.Dimension(242, 26));
        jPanel2.add(ProgBar, new org.netbeans.lib.awtextra.AbsoluteConstraints(259, 0, 215, 30));

        CurrentSongLabel.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        CurrentSongLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        CurrentSongLabel.setText("No Current Song");
        CurrentSongLabel.setMaximumSize(new java.awt.Dimension(30, 255));
        CurrentSongLabel.setMinimumSize(new java.awt.Dimension(30, 255));
        jPanel2.add(CurrentSongLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 240, 30));

        getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(685, 53, 650, 30));

        Song_Info_Box.setBackground(new java.awt.Color(242, 242, 242));
        Song_Info_Box.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
        Song_Info_Box.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 4));
        Song_Info_Box.setMaximumSize(new java.awt.Dimension(11720, 11190));
        Song_Info_Box.setMinimumSize(new java.awt.Dimension(955, 190));
        Song_Info_Box.setOpaque(true);
        Song_Info_Box.setPreferredSize(new java.awt.Dimension(955, 190));
        getContentPane().add(Song_Info_Box, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 48, 650, 208));

        Media_Player_Box.setBackground(new java.awt.Color(205, 205, 195));
        Media_Player_Box.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
        Media_Player_Box.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 4));
        Media_Player_Box.setMaximumSize(new java.awt.Dimension(11111, 11111));
        Media_Player_Box.setMinimumSize(new java.awt.Dimension(360, 190));
        Media_Player_Box.setOpaque(true);
        Media_Player_Box.setPreferredSize(new java.awt.Dimension(360, 190));
        getContentPane().add(Media_Player_Box, new org.netbeans.lib.awtextra.AbsoluteConstraints(680, 48, 660, 40));

        Library_Box.setBackground(new java.awt.Color(242, 242, 242));
        Library_Box.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 4));
        Library_Box.setMaximumSize(new java.awt.Dimension(1320, 420));
        Library_Box.setMinimumSize(new java.awt.Dimension(1320, 420));
        Library_Box.setOpaque(true);
        Library_Box.setPreferredSize(new java.awt.Dimension(1320, 420));
        getContentPane().add(Library_Box, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 260, 650, 403));

        Recommendations_Box.setBackground(new java.awt.Color(242, 242, 242));
        Recommendations_Box.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(66, 66, 66), 4));
        Recommendations_Box.setMaximumSize(new java.awt.Dimension(1320, 420));
        Recommendations_Box.setMinimumSize(new java.awt.Dimension(1320, 420));
        Recommendations_Box.setOpaque(true);
        Recommendations_Box.setPreferredSize(new java.awt.Dimension(1320, 420));
        getContentPane().add(Recommendations_Box, new org.netbeans.lib.awtextra.AbsoluteConstraints(681, 93, 660, 570));

        feedbackButton.setText("Give Feedback");
        feedbackButton.setFocusPainted(false);
        feedbackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                feedbackButtonActionPerformed(evt);
            }
        });
        getContentPane().add(feedbackButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(1220, 20, 120, -1));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("Tester Copy");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1110, 20, 100, 20));

        jMenuBar1.setBorder(null);

        Menu_File.setText("File");

        Import_Library_Menu_Item.setText("Import New Library");
        Import_Library_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Import_Library_Menu_ItemActionPerformed(evt);
            }
        });
        Menu_File.add(Import_Library_Menu_Item);

        jMenuBar1.add(Menu_File);

        Menu_Help.setText("Help");

        jMenuItem2.setText("User Guide");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        Menu_Help.add(jMenuItem2);

        jMenuBar1.add(Menu_Help);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Import_Library_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Import_Library_Menu_ItemActionPerformed
        UpdateLibraryImp.startLibrary();
    }//GEN-LAST:event_Import_Library_Menu_ItemActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        try {
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\Users\\Alexander\\MuRec\\UserGuide.pdf");
        } catch (IOException e) {
            JOptionPane.showMessageDialog(null, "Error");  //print the error
        }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void SearchTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_SearchTextFieldKeyPressed
        // TODO add your handling code here:
        String SearchEntry = SearchTextField.getText().toLowerCase();
        DefaultTableModel model = (DefaultTableModel) userLibrary.getModel();

        if (!"".equals(SearchEntry) || SearchEntry != null) {
            // clear existing rows

            //System.out.println("all songs have been imported");
            List<String> data;

            try {
                ResultSet results = RecordsMain.dba.SearchBar(SearchEntry);
                while (model.getRowCount() > 0) {
                    model.removeRow(0);
                }
                while (results.next()) {
                    data = new LinkedList<>();
                    // Build a Vector of Strings for the table row
                    data.add(results.getString("SONG_TITLE"));
                    data.add(results.getString("ARTIST"));
                    data.add(results.getString("ALBUM"));
                    data.add(results.getString("GENRE"));
                    data.add(results.getString("ENERGY"));
                    data.add(results.getString("DANCEABILITY"));
                    data.add(results.getString("ACOUSTICNESS"));
                    data.add(results.getString("BPM"));
                    data.add(results.getString("THE_KEY"));
                    data.add(results.getString("LOCATION"));

                    // Add the data row to the table.
                    model.addRow(data.toArray());
                }
            } catch (SQLException ex) {
                ex.printStackTrace();  // FOR DEBUGGING ONLY

            } catch (Exception ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }

        } else {
            // clear existing rows
            while (model.getRowCount() > 0) {
                model.removeRow(0);
            }

            System.out.println("all songs have been imported");
            List<String> data;

            try {
                ResultSet results = RecordsMain.dba.getAllLibrary();

                while (results.next()) {
                    data = new LinkedList<>();
                    // Build a Vector of Strings for the table row
                    data.add(results.getString("SONG_TITLE"));
                    data.add(results.getString("ARTIST"));
                    data.add(results.getString("ALBUM"));
                    data.add(results.getString("GENRE"));
                    data.add(results.getString("ENERGY"));
                    data.add(results.getString("DANCEABILITY"));
                    data.add(results.getString("ACOUSTICNESS"));
                    data.add(results.getString("BPM"));
                    data.add(results.getString("THE_KEY"));
                    data.add(results.getString("LOCATION"));

                    // Add the data row to the table.
                    model.addRow(data.toArray());
                }
            } catch (SQLException ex) {
                ex.printStackTrace();  // FOR DEBUGGING ONLY

            } catch (Exception ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }

        }
    }//GEN-LAST:event_SearchTextFieldKeyPressed

    private void PlayButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PlayButtonActionPerformed
        String song = titleTextField.getText();
        String artist = artistTextField.getText();
        String Loc = locationTextField.getText();
        //System.out.println(song);
        //System.out.println(artist);
        //System.out.println(Loc);

        ResultSet result;
        if (PlayerUserInterface.getmusicPlayer() != null) {
            //System.out.println("not Null!");
            if (null != PlayerUserInterface.getStatus()) {
                switch (PlayerUserInterface.getStatus()) {
                    case "PLAYING":
                        PlayerUserInterface.StopButton();
                        if ("Directory".equals(Loc)) {
                            try {
                                result = RecordsMain.dba.getLibFilePathway(song, artist);
                                if (result.next()) {
                                    PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                                }
                            } catch (SQLException ex) {
                                Logger.getLogger(UserInterfaceUI.class
                                        .getName()).log(Level.SEVERE, null, ex);
                            }
                        } else {
                            try {
                                result = RecordsMain.dba.getFilePathway(song, artist);
                                if (result.next()) {
                                    PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                                }
                            } catch (SQLException ex) {
                                Logger.getLogger(UserInterfaceUI.class
                                        .getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                        beginMarquee(song + " - " + artist);
                        break;
                    case "PAUSED":
                        PlayerUserInterface.ResumeButton();
                        //PlayTitleField.setText(song + " - " + artist);
                        break;
                    case "STOPPED":
                        if ("Directory".equals(Loc)) {
                            try {
                                result = RecordsMain.dba.getLibFilePathway(song, artist);
                                if (result.next()) {
                                    PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                                }
                            } catch (SQLException ex) {
                                Logger.getLogger(UserInterfaceUI.class
                                        .getName()).log(Level.SEVERE, null, ex);
                            }
                        } else {
                            try {
                                result = RecordsMain.dba.getFilePathway(song, artist);
                                if (result.next()) {
                                    PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                                }
                            } catch (SQLException ex) {
                                Logger.getLogger(UserInterfaceUI.class
                                        .getName()).log(Level.SEVERE, null, ex);
                            }
                        }
                        beginMarquee(song + " - " + artist);
                        break;
                }
            }
        } else {
            if ("Directory".equals(Loc)) {
                try {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                    }
                } catch (SQLException ex) {
                    Logger.getLogger(UserInterfaceUI.class
                            .getName()).log(Level.SEVERE, null, ex);
                }
            } else {
                try {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        PlayerUserInterface.PlayButton(result.getString("FilePathway").replaceAll("~", "'"), Loc, song);

                    }
                } catch (SQLException ex) {
                    Logger.getLogger(UserInterfaceUI.class
                            .getName()).log(Level.SEVERE, null, ex);
                }
            }
            beginMarquee(song + " - " + artist);
        }
    }//GEN-LAST:event_PlayButtonActionPerformed

    private void StopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopButtonActionPerformed
        PlayerUserInterface.StopButton();
        beginMarquee("No current song playing");
    }//GEN-LAST:event_StopButtonActionPerformed

    private void PauseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PauseButtonActionPerformed
        PlayerUserInterface.PauseButton();
    }//GEN-LAST:event_PauseButtonActionPerformed

    private void itunesDownloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itunesDownloadButtonActionPerformed
        String song = titleTextField.getText();
        String artist = artistTextField.getText();
        String URLString = null;
        try {
            Desktop d = Desktop.getDesktop();
            ResultSet results = RecordsMain.dba.getPurchaseURL(song, artist);
            if (results.next()) {
                URLString = results.getString("Purchase_Link");
            }
            d.browse(new URI(URLString));

        } catch (IOException | URISyntaxException ex) {
            Logger.getLogger(UserInterfaceUI.class
                    .getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(UserInterfaceUI.class
                    .getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_itunesDownloadButtonActionPerformed

    private void amazonDownloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_amazonDownloadButtonActionPerformed
        // TODO add your handling code here:
        String song = titleTextField.getText().replaceAll(" ", "+");
        String artist = artistTextField.getText().replaceAll(" ", "+");
        try {
            Desktop d = Desktop.getDesktop();

            d.browse(new URI("http://www.amazon.com/s/ref=sr_nr_p_lbr_music_artists__0?fst=as%3Aoff&rh=n%3A163856011%2Ck%3A" + song + "+" + artist + "%2Cp_n_feature_browse-bin%3A625151011%2Cp_lbr_music_artists_browse-bin%3A" + artist + "&bbn=163856011&keywords=" + song + "+" + artist + "&ie=UTF8&qid=1419431329&rnid=3458810011"));

        } catch (IOException | URISyntaxException ex) {
            Logger.getLogger(UserInterfaceUI.class
                    .getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_amazonDownloadButtonActionPerformed

    private void SelectAllCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_SelectAllCheckBoxItemStateChanged
        // TODO add your handling code here:
        if (SelectAllCheckBox.isSelected()) {
            if (!BillboardCheckbox.isSelected()) {
                BillboardCheckbox.doClick();
            }
            if (!BillboardEDMCheckbox.isSelected()) {
                BillboardEDMCheckbox.doClick();
            }
            if (!BillboardCountryCheckbox.isSelected()) {
                BillboardCountryCheckbox.doClick();
            }
            if (!BillboardRnBCheckbox.isSelected()) {
                BillboardRnBCheckbox.doClick();
            }
            if (!HypeCheckbox.isSelected()) {
                HypeCheckbox.doClick();
            }
            if (!ItunesCheckbox.isSelected()) {
                ItunesCheckbox.doClick();
            }
            if (!ShazamCheckbox.isSelected()) {
                ShazamCheckbox.doClick();
            }
            if (!ItunesCountryCheckbox.isSelected()) {
                ItunesCountryCheckbox.doClick();
            }
            if (!ItunesRnBCheckbox.isSelected()) {
                ItunesRnBCheckbox.doClick();
            }
            if (!ItunesEDMCheckbox.isSelected()) {
                ItunesEDMCheckbox.doClick();
            }
            if (!UKCheckbox.isSelected()) {
                UKCheckbox.doClick();
            }
            if (!BeatportCheckbox.isSelected()) {
                BeatportCheckbox.doClick();
            }
        } else {
            BillboardCheckbox.doClick();
            BillboardEDMCheckbox.doClick();
            BillboardCountryCheckbox.doClick();
            BillboardRnBCheckbox.doClick();
            HypeCheckbox.doClick();
            ItunesCheckbox.doClick();
            ItunesCountryCheckbox.doClick();
            ItunesRnBCheckbox.doClick();
            ItunesEDMCheckbox.doClick();
            UKCheckbox.doClick();
            ShazamCheckbox.doClick();
            BeatportCheckbox.doClick();
        }
    }//GEN-LAST:event_SelectAllCheckBoxItemStateChanged

    private void userLibraryMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_userLibraryMouseClicked
        //String from = "LibTable";
        String Danceability, Energy, Acousticness, song, artist, location, image, album, genre, bpm, theKey;

        itunesDownloadButton.setVisible(false);
        amazonDownloadButton.setVisible(false);
        int row = userLibrary.getSelectedRow();
        song = userLibrary.getModel().getValueAt(row, 0).toString();
        String songView = userLibrary.getValueAt(row, 0).toString();

        ArrayList list = TableAttributeAdjust.AdjustAttributes(song, songView, userLibrary, row);

        song = list.get(0).toString();
        artist = list.get(1).toString();
        album = list.get(2).toString();
        genre = list.get(3).toString();
        Energy = list.get(4).toString();
        Danceability = list.get(5).toString();
        Acousticness = list.get(6).toString();
        bpm = list.get(7).toString();
        theKey = list.get(8).toString();

        location = "Directory";
        image = "";

        BasedOn.setText("Based On: " + song + " by " + artist);
        try {
            ResultSet results = RecordsMain.dba.getImagepath(album);
            if (results.next()) {
                image = results.getString("Image");
            }

            ResultSet result = RecordsMain.dba.getLibFilePathway(song, artist);
            if (result.next()) {
                setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
            }

        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        RecTable.bottomTable(song, theKey, bpm, genre, album, artist, location, Danceability, Energy, Acousticness);

        titleTextField.setText(song);
        artistTextField.setText(artist);
        albumTextField.setText(album);
        genreTextField.setText(genre);
        bpmTextField.setText(bpm);
        keyTextField.setText(theKey);
        locationTextField.setText(location);
        if (Switch == null) {
            Switch = new SwitchPic(location, image);
            Switch.start();
        } else {
            Switch.close();
            Switch = new SwitchPic(location, image);
            Switch.start();
        }
        RecTable.bottomTable(song, theKey, bpm, genre, album, artist, location, Danceability, Energy, Acousticness);

        if (evt.getClickCount() == 2) {

            try {
                ResultSet result = RecordsMain.dba.getLibFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                }
                if (PlayerUserInterface.getmusicPlayer() != null) {
                    PlayerUserInterface.getmusicPlayer().close();
                }
                beginMarquee(song + " - " + artist);
                PlayerUserInterface.PlayButton(getCurrentPath(), location, song);

            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_userLibraryMouseClicked

    private void userLibraryEnter(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_userLibraryEnter
        String Danceability;
        String Energy;
        String Acousticness;
        String song = null;
        String artist = null;
        String album;
        String genre;
        String bpm;
        String theKey;
        String location = null;
        String image;
        if ((evt.getKeyCode() == KeyEvent.VK_DOWN) || (evt.getKeyCode() == KeyEvent.VK_UP)) {
            itunesDownloadButton.setVisible(false);
            amazonDownloadButton.setVisible(false);

            int row = userLibrary.getSelectedRow();
            song = userLibrary.getModel().getValueAt(row, 0).toString();
            String songView = userLibrary.getValueAt(row, 0).toString();
            if (row < userLibrary.getRowCount() - 1) {
                row = userLibrary.getSelectedRow() + 1;
            }
            if (evt.getKeyCode() == KeyEvent.VK_UP) {
                if (row < userLibrary.getRowCount() - 1) {
                    row = userLibrary.getSelectedRow() - 1;
                }
            }
            ArrayList list = TableAttributeAdjust.AdjustAttributes(song, songView, userLibrary, row);

            song = list.get(0).toString();
            artist = list.get(1).toString();
            album = list.get(2).toString();
            genre = list.get(3).toString();
            Energy = list.get(4).toString();
            Danceability = list.get(5).toString();
            Acousticness = list.get(6).toString();
            bpm = list.get(7).toString();
            theKey = list.get(8).toString();
            location = "Directory";
            image = "";

            BasedOn.setText("Based On: " + song + " by " + artist);

            try {
                ResultSet results = RecordsMain.dba.getImagepath(album);
                if (results.next()) {
                    image = results.getString("Image");
                }

                ResultSet result = RecordsMain.dba.getLibFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                }

            } catch (SQLException ex) {
                ex.printStackTrace();
            }

            titleTextField.setText(song);
            artistTextField.setText(artist);
            albumTextField.setText(album);
            genreTextField.setText(genre);
            bpmTextField.setText(bpm);
            keyTextField.setText(theKey);
            locationTextField.setText(location);

            if (Switch == null) {
                Switch = new SwitchPic(location, image);
                Switch.start();
            } else {
                Switch.close();
                Switch = new SwitchPic(location, image);
                Switch.start();
            }
            RecTable.bottomTable(song, theKey, bpm, genre, album, artist, location, Danceability, Energy, Acousticness);
        }
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            location = locationTextField.getText();
            song = titleTextField.getText();
            artist = artistTextField.getText();
            try {
                ResultSet result;
                if ("Directory".equals(location)) {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                } else {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                }

                if (PlayerUserInterface.getmusicPlayer() != null) {
                    PlayerUserInterface.getmusicPlayer().close();
                }
                beginMarquee(song + " - " + artist);
                PlayerUserInterface.PlayButton(getCurrentPath(), location, song);

            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_userLibraryEnter

    private void SelectAllCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SelectAllCheckBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_SelectAllCheckBoxActionPerformed

    private void songPrefTableEnter(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_songPrefTableEnter
        // TODO add your handling code here:
        String song = null;
        String artist = null;
        String album;
        String genre;
        String bpm;
        String theKey;
        String location = null;
        String image;
        if ((evt.getKeyCode() == KeyEvent.VK_DOWN) || (evt.getKeyCode() == KeyEvent.VK_UP)) {
            itunesDownloadButton.setVisible(false);
            amazonDownloadButton.setVisible(false);
            int row = songPrefTable.getSelectedRow();
            if (row < songPrefTable.getRowCount() - 1) {
                row = songPrefTable.getSelectedRow() + 1;
            } else {
                row = songPrefTable.getSelectedRow();
            }
            if (evt.getKeyCode() == KeyEvent.VK_UP) {
                if (row < songPrefTable.getRowCount() - 1) {
                    row = songPrefTable.getSelectedRow() - 1;
                } else {
                    row = songPrefTable.getSelectedRow();
                }
            }

            song = songPrefTable.getModel().getValueAt(row, 0).toString();
            artist = songPrefTable.getModel().getValueAt(row, 1).toString();
            album = songPrefTable.getModel().getValueAt(row, 2).toString();
            genre = songPrefTable.getModel().getValueAt(row, 3).toString();
            bpm = songPrefTable.getModel().getValueAt(row, 4).toString();
            theKey = songPrefTable.getModel().getValueAt(row, 5).toString();
            location = songPrefTable.getModel().getValueAt(row, 6).toString();
            image = "";

            try {
                ResultSet results = RecordsMain.dba.getImagepath(album);
                if (results.next()) {
                    image = results.getString("Image");
                }

                ResultSet result;
                if ("Directory".equals(location)) {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                } else {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                }

            } catch (SQLException ex) {
                ex.printStackTrace();  // FOR DEBUGGING ONLY
            }

            titleTextField.setText(song);
            artistTextField.setText(artist);
            albumTextField.setText(album);
            genreTextField.setText(genre);
            bpmTextField.setText(bpm);
            keyTextField.setText(theKey);
            locationTextField.setText(location);

            if (Switch == null) {
                Switch = new SwitchPic(location, image);
                Switch.start();
            } else {
                Switch.close();
                Switch = new SwitchPic(location, image);
                Switch.start();
            }
        }
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            location = locationTextField.getText();
            song = titleTextField.getText();
            artist = artistTextField.getText();
            try {
                ResultSet result;
                if ("Directory".equals(location)) {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                } else {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                }

                if (PlayerUserInterface.getmusicPlayer() != null) {
                    PlayerUserInterface.getmusicPlayer().close();
                }
                beginMarquee(song + " - " + artist);
                PlayerUserInterface.PlayButton(getCurrentPath(), location, song);

            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_songPrefTableEnter

    private void songPrefTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_songPrefTableMouseClicked
        // TODO add your handling code here:
        String song, artist, location, image, album, genre, bpm, theKey;
        itunesDownloadButton.setVisible(false);
        amazonDownloadButton.setVisible(false);
        int row = songPrefTable.getSelectedRow();
        song = songPrefTable.getModel().getValueAt(row, 0).toString();
        String songView = songPrefTable.getValueAt(row, 0).toString();

        ArrayList list = TableAttributeAdjust.AdjustAttributes(song, songView, songPrefTable, row);

        song = list.get(0).toString();
        artist = list.get(1).toString();
        album = list.get(2).toString();
        genre = list.get(3).toString();
        bpm = list.get(4).toString();
        theKey = list.get(5).toString();
        location = list.get(6).toString();
        image = "";
        try {
            ResultSet results = RecordsMain.dba.getImagepath(album);
            if (results.next()) {
                image = results.getString("Image");
            }

            ResultSet result;
            if ("Directory".equals(location)) {
                result = RecordsMain.dba.getLibFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                }
            } else {
                result = RecordsMain.dba.getFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                }
            }
        } catch (SQLException ex) {
            ex.printStackTrace();  // FOR DEBUGGING ONLY
        }

        titleTextField.setText(song);
        artistTextField.setText(artist);
        albumTextField.setText(album);
        genreTextField.setText(genre);
        bpmTextField.setText(bpm);
        keyTextField.setText(theKey);
        locationTextField.setText(location);

        if (Switch == null) {
            Switch = new SwitchPic(location, image);
            Switch.start();
        } else {
            Switch.close();
            Switch = new SwitchPic(location, image);
            Switch.start();
        }

        if (evt.getClickCount() == 2) {
            try {
                ResultSet result;
                if ("Directory".equals(location)) {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                } else {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                }

                if (PlayerUserInterface.getmusicPlayer() != null) {
                    PlayerUserInterface.getmusicPlayer().close();
                }
                beginMarquee(song + " - " + artist);
                PlayerUserInterface.PlayButton(getCurrentPath(), location, song);

            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_songPrefTableMouseClicked

    private void rssChartsTableEnter(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_rssChartsTableEnter
        String song = null;
        String artist = null;
        String album;
        String genre;
        String bpm;
        String theKey;
        String location = null;
        String image;

        if ((evt.getKeyCode() == KeyEvent.VK_DOWN) || (evt.getKeyCode() == KeyEvent.VK_UP)) {
            itunesDownloadButton.setVisible(false);
            amazonDownloadButton.setVisible(false);
            int row = rssChartsTable.getSelectedRow();
            song = rssChartsTable.getModel().getValueAt(row, 0).toString();
            String songView = rssChartsTable.getValueAt(row, 0).toString();
            if (row < rssChartsTable.getRowCount() - 1) {
                row = rssChartsTable.getSelectedRow() + 1;
            }
            if (evt.getKeyCode() == KeyEvent.VK_UP) {
                if (row < rssChartsTable.getRowCount() - 1) {
                    row = rssChartsTable.getSelectedRow() - 1;
                }
            }
            ArrayList list = TableAttributeAdjust.AdjustAttributes(song, songView, rssChartsTable, row);

            song = list.get(0).toString();
            artist = list.get(1).toString();
            album = list.get(2).toString();
            genre = list.get(3).toString();
            bpm = list.get(4).toString();
            theKey = list.get(5).toString();
            location = list.get(6).toString();
            image = "";

            try {
                ResultSet results = RecordsMain.dba.getImagepath(album);
                if (results.next()) {
                    image = results.getString("Image");
                }

                ResultSet result = RecordsMain.dba.getFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                }

            } catch (SQLException ex) {
                ex.printStackTrace();  // FOR DEBUGGING ONLY
            }

            titleTextField.setText(song);
            artistTextField.setText(artist);
            albumTextField.setText(album);
            genreTextField.setText(genre);
            bpmTextField.setText(bpm);
            keyTextField.setText(theKey);
            locationTextField.setText(location);
            if (Switch == null) {
                Switch = new SwitchPic(location, image);
                Switch.start();
            } else {
                Switch.close();
                Switch = new SwitchPic(location, image);
                Switch.start();
            }
        }
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            location = locationTextField.getText();
            song = titleTextField.getText();
            artist = artistTextField.getText();
            try {
                ResultSet result;
                if ("Directory".equals(location)) {
                    result = RecordsMain.dba.getLibFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                } else {
                    result = RecordsMain.dba.getFilePathway(song, artist);
                    if (result.next()) {
                        setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));
                    }
                }

                if (PlayerUserInterface.getmusicPlayer() != null) {
                    PlayerUserInterface.getmusicPlayer().close();
                }
                beginMarquee(song + " - " + artist);
                PlayerUserInterface.PlayButton(getCurrentPath(), location, song);

            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_rssChartsTableEnter

    private void rssChartsTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rssChartsTableMouseClicked
        String song, artist, location, image, album, genre, bpm, theKey;
        itunesDownloadButton.setVisible(true);
        amazonDownloadButton.setVisible(true);
        int row = rssChartsTable.getSelectedRow();

        song = rssChartsTable.getModel().getValueAt(row, 0).toString();
        String songView = rssChartsTable.getValueAt(row, 0).toString();

        ArrayList list = TableAttributeAdjust.AdjustAttributes(song, songView, rssChartsTable, row);

        song = list.get(0).toString();
        artist = list.get(1).toString();
        album = list.get(2).toString();
        genre = list.get(3).toString();
        bpm = list.get(4).toString();
        theKey = list.get(5).toString();
        location = list.get(6).toString();
        image = "";

        titleTextField.setText(song);
        artistTextField.setText(artist);
        albumTextField.setText(album);
        genreTextField.setText(genre);
        bpmTextField.setText(bpm);
        keyTextField.setText(theKey);
        locationTextField.setText(location);
        if (Switch == null) {
            Switch = new SwitchPic(location, image);
            Switch.start();
        } else {
            Switch.close();
            Switch = new SwitchPic(location, image);
            Switch.start();
        }

        if (evt.getClickCount() == 2) {
            ResultSet result;
            try {
                result = RecordsMain.dba.getFilePathway(song, artist);
                if (result.next()) {
                    setCurrentPath(result.getString("FilePathway").replaceAll("~", "'"));

                }
            } catch (SQLException ex) {
                Logger.getLogger(UserInterfaceUI.class
                        .getName()).log(Level.SEVERE, null, ex);
            }
            if (PlayerUserInterface.getmusicPlayer() != null) {
                PlayerUserInterface.getmusicPlayer().close();
            }
            beginMarquee(song + " - " + artist);
            PlayerUserInterface.PlayButton(getCurrentPath(), location, song);
        }
    }//GEN-LAST:event_rssChartsTableMouseClicked

    private void feedbackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_feedbackButtonActionPerformed
        // TODO add your handling code here:
        RecordsMain.dialog.setVisible(true);
    }//GEN-LAST:event_feedbackButtonActionPerformed

    private void jPanel1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jPanel1FocusGained
        // TODO add your handling code here:
    }//GEN-LAST:event_jPanel1FocusGained

    private void jPanel1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jPanel1FocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_jPanel1FocusLost

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
        //System.out.println("Selected paneNo : " + jTabbedPane1.getSelectedIndex());
        if (jTabbedPane1.getSelectedIndex() == 1) {
            BasedOn.setVisible(false);
            DefaultTableModel model = (DefaultTableModel) RecordsMain.getUI().rssChartsTable.getModel();
            if (model.getRowCount() == 1) {
                RecordsMain.getUI().chartSongNum.setText(model.getRowCount() + " Song");
            } else {
                RecordsMain.getUI().chartSongNum.setText(model.getRowCount() + " Songs");
            }
        } else {
            BasedOn.setVisible(true);
            DefaultTableModel model = (DefaultTableModel) RecordsMain.getUI().songPrefTable.getModel();
            if (model.getRowCount() == 1) {
                RecordsMain.getUI().chartSongNum.setText(model.getRowCount() + " Song");
            } else {
                RecordsMain.getUI().chartSongNum.setText(model.getRowCount() + " Songs");
            }
        }
    }//GEN-LAST:event_jTabbedPane1StateChanged

    private void BeatportCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BeatportCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_BeatportCheckboxItemStateChanged

    private void ItunesEDMCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItunesEDMCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_ItunesEDMCheckboxItemStateChanged

    private void BillboardEDMCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BillboardEDMCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_BillboardEDMCheckboxItemStateChanged

    private void ItunesRnBCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItunesRnBCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_ItunesRnBCheckboxItemStateChanged

    private void BillboardRnBCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BillboardRnBCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_BillboardRnBCheckboxItemStateChanged

    private void ItunesCountryCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItunesCountryCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_ItunesCountryCheckboxItemStateChanged

    private void BillboardCountryCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BillboardCountryCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_BillboardCountryCheckboxItemStateChanged

    private void ItunesCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ItunesCheckboxItemStateChanged
        // TODO add your handling code here:
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_ItunesCheckboxItemStateChanged

    private void ShazamCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ShazamCheckboxItemStateChanged
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_ShazamCheckboxItemStateChanged

    private void UKCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_UKCheckboxItemStateChanged
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_UKCheckboxItemStateChanged

    private void HypeCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_HypeCheckboxItemStateChanged
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_HypeCheckboxItemStateChanged

    private void BillboardCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BillboardCheckboxItemStateChanged
        CheckboxChange.rssChartLocation();
    }//GEN-LAST:event_BillboardCheckboxItemStateChanged

    public void beginMarquee(String songLine) {
        RecordsMain.marqTest.setText(songLine);
        if (songLine.length() > 26) {
            RecordsMain.marqTest.stopMoving();
            RecordsMain.marqTest.start();
        } else {
            RecordsMain.marqTest.stopMoving();
            CurrentSongLabel.setText(songLine);
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JLabel BasedOn;
    public javax.swing.JCheckBox BeatportCheckbox;
    public static javax.swing.JCheckBox BillboardCheckbox;
    public static javax.swing.JCheckBox BillboardCountryCheckbox;
    public static javax.swing.JCheckBox BillboardEDMCheckbox;
    public static javax.swing.JCheckBox BillboardRnBCheckbox;
    private javax.swing.JTabbedPane ChartTab;
    private javax.swing.JLabel CountryLabel;
    private javax.swing.JPanel CountryPane;
    public javax.swing.JLabel CurrentSongLabel;
    private javax.swing.JLabel Echnest1;
    private javax.swing.JLabel Echnest3;
    private javax.swing.JLabel Echnest6;
    private javax.swing.JLabel Echnest7;
    private javax.swing.JLabel ElectronicLabel;
    private javax.swing.JPanel ElectronicPane;
    public static javax.swing.JCheckBox HypeCheckbox;
    private javax.swing.JMenuItem Import_Library_Menu_Item;
    public static javax.swing.JCheckBox ItunesCheckbox;
    public static javax.swing.JCheckBox ItunesCountryCheckbox;
    public static javax.swing.JCheckBox ItunesEDMCheckbox;
    public static javax.swing.JCheckBox ItunesRnBCheckbox;
    private javax.swing.JLabel Library_Box;
    private javax.swing.JLabel LocationLabel;
    private javax.swing.JLabel Media_Player_Box;
    private javax.swing.JMenu Menu_File;
    private javax.swing.JMenu Menu_Help;
    private javax.swing.JLabel MusicRecLabel;
    public static javax.swing.JTextField NumSongs;
    private javax.swing.JButton PauseButton;
    public static javax.swing.JButton PlayButton;
    public static javax.swing.JTextField PlayTime;
    private javax.swing.JLabel PopLabel;
    private javax.swing.JPanel PopPane;
    public static javax.swing.JSlider ProgBar;
    private javax.swing.JLabel Recommendations_Box;
    private javax.swing.JLabel RnBLabel;
    private javax.swing.JPanel RnBPane;
    private javax.swing.JLabel SearchLabel;
    private javax.swing.JTextField SearchTextField;
    private javax.swing.JCheckBox SelectAllCheckBox;
    public static javax.swing.JCheckBox ShazamCheckbox;
    private javax.swing.JLabel Song_Info_Box;
    public static javax.swing.JButton StopButton;
    private javax.swing.JLabel TitleLabel;
    private javax.swing.JLabel TitleLabel1;
    public static javax.swing.JCheckBox UKCheckbox;
    private javax.swing.JLabel YourLibrary;
    private javax.swing.JLabel YourLibrary1;
    public static javax.swing.JLabel albumCover;
    private javax.swing.JLabel albumLabel;
    public static javax.swing.JTextField albumTextField;
    public static javax.swing.JButton amazonDownloadButton;
    private javax.swing.JLabel artistLabel;
    public static javax.swing.JTextField artistTextField;
    private javax.swing.JLabel bpmLabel;
    public static javax.swing.JTextField bpmTextField;
    public static javax.swing.JLabel chartSongNum;
    private javax.swing.JButton feedbackButton;
    private javax.swing.JLabel genreLabel1;
    public static javax.swing.JTextField genreTextField;
    public static javax.swing.JButton itunesDownloadButton;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    public javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel keyLabel;
    public static javax.swing.JTextField keyTextField;
    public static javax.swing.JTextField locationTextField;
    public static javax.swing.JTable rssChartsTable;
    public static javax.swing.JTable songPrefTable;
    private javax.swing.JLabel titleLabel;
    public static javax.swing.JTextField titleTextField;
    public static javax.swing.JTable userLibrary;
    // End of variables declaration//GEN-END:variables
}
